import request from '@/utils/request'

// 保险订单列表page
export function getList(form, pageSize, currentPage) {
  const data = {
    param: form,
    pageSize: pageSize,
    pageNo: currentPage
  }
  return request.post('/sq/order/xc/page', data)
}

// 定金订单列表详情
export function detailById(id) {
  return request.get(`/sq/order/xc/detail/${id}`)
}

// 获取票据信息
export function getInvoice(id) {
  return request.get(`/sq/order/xc/getInvoice/${id}`)
}

// 开票
export function makeOutInvoice(data) {
  return request.post('/sq/order/xc/makeOutInvoice', data)
}

// 配车
export function matchCar(id, vin) {
  return request.post(`/sq/order/xc/matchCar/${id}/${vin}`)
}

// 出库
export function outbound(id) {
  return request.get(`/sq/order/xc/outbound/${id}`)
}

// 退款审批
export function refundApproval(id) {
  return request.get(`/sq/order/xc/refundApproval/${id}`)
}

// 退货审批
export function returnApproval(id) {
  return request.get(`/sq/order/xc/returnApproval/${id}`)
}

// 销售退货
export function sellReturn(id) {
  return request.get(`/sq/order/xc/sellReturn/${id}`)
}

//销售清单历史表
export function saleApplyList(carOrderMainId) {
  return request.get(`/sq/order/xc/saleApply/list/${carOrderMainId}`)
}

//销售申请单详情
export function saleApplyDetail(id) {
  return request.get(`/sq/order/xc/saleApply/detail/${id}`)
}

// 订单状态修改 
//status 0未下订单 1下订单 2未付首付、3未付尾款、4待提车、5已提车、6已完结、7已作废
export function updateStatus(id, status) {
  return request.post(`/sq/order/xc/updateStatus/${id}/${status}`)
}

// 申请红冲订单
export function addRedOrder(data) {
  return request.post(`/sq/order/xc/addRedOrder`, data)
}

// 红冲审核信息
export function seeRedOrder(carOrderMainId) {
  return request.post(`/sq/order/xc/seeRedOrder/${carOrderMainId}`)
}

// 审核红冲订单
export function auditRedOrder(id, status) {
  return request.post(`/sq/order/xc/auditRedOrder/${id}/${status}`)
}


// 根据车型获取所有库存车架号
export function findInventoryVin(carModelId) {
  return request.post(`/sq/order/xc/findInventoryVin/${carModelId}`)
}